/*
 * @lc app=leetcode.cn id=686 lang=java
 *
 * [686] 重复叠加字符串匹配
 */

// @lc code=start
class Solution {
    public int repeatedStringMatch(String a, String b) {
        String temp = a;
        int index = 1;
        while (true) {
            if (temp.contains(b)) {
                return index;
            }
            if (temp.length() > b.length() + a.length()) {
                return -1;
            }
            temp += a;
            index++;
        }

    }
}
// @lc code=end
